#!/usr/bin/python3
# -*- coding: utf-8 -*-
# ======================================#
# @Author   : duanqizhong
# @time     : 2021-1-3 22:58
# @file     : cli.py
# @Software : PyCharm
# ======================================#

from argparse import ArgumentParser

from src.crontab.crontab_fund import fund_TOP, fund_FOCUS, fund_AI, fund_TOP_ok, get_up_up_fund, get_down_down_fund


def args_run():
    prase = ArgumentParser()
    prase.add_argument("--type", dest="type", type=str, required=True, default="myfund")
    prase.add_argument("--top", dest="top", type=int, default=10)
    prase.add_argument("--percent", dest="per", type=float, default=1.0)
    args = prase.parse_args()
    type = args.type
    top = args.top
    per = args.per
    if type == "top":
        fund_TOP(top=top)
    elif type == "focus":
        fund_FOCUS()
    elif type == "AI":
        fund_AI(top=top)
    elif type == "top_AI":
        fund_TOP_ok(top=top)
    elif type == "Up":
        get_up_up_fund(per=per)
    elif type == "Down":
        get_down_down_fund(per=per)
    else:
        raise Exception(f"not found this type: {type},please make sure it!")


if __name__ == "__main__":
    args_run()
